package org.hcyspartnoc.demo.dao;

import org.hcyspartnoc.demo.entity.Course;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;

public interface CourseDao  extends Neo4jRepository<Course,Long> {

    @Query("MATCH (n) " +
            "where id(n) = $nodeId " +
            "CREATE (c:course {name: $name}) " +
            "MERGE (c)-[:H]->(n)")
    void saveCourseH(@Param("nodeId") Integer nodeId,
                    @Param("name") String name);
    @Query("MATCH (n) " +
            "where id(n) = $nodeId " +
            "CREATE (c:course {name: $name}) " +
            "MERGE (c)-[:M]->(n)")
    void saveCourseM(@Param("nodeId") Integer nodeId,
                    @Param("name") String name);
    @Query("MATCH (n) " +
            "where id(n) = $nodeId " +
            "CREATE (c:course {name: $name}) " +
            "MERGE (c)-[:L]->(n)")
    void saveCourseL(@Param("nodeId") Integer nodeId,
                    @Param("name") String name);
}
